<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// Route::middleware('auth:api')->get('/user', function (Request $request) {
//     return $request->user();
// });

#在访问接口路由的时候前缀必须加上api
// eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImJiMWQ5YjJmYWIwMDIzYzg3ZWE3N2NjZGMzOTRiNWRmNzgzY2JjYmJiN2NkNjlmMmE5N2M3M2RhNjc3OTJkYzcyNTdiMmRiMTRiODgzMjdmIn0.eyJhdWQiOiIxIiwianRpIjoiYmIxZDliMmZhYjAwMjNjODdlYTc3Y2NkYzM5NGI1ZGY3ODNjYmNiYmI3Y2Q2OWYyYTk3YzczZGE2Nzc5MmRjNzI1N2IyZGIxNGI4ODMyN2YiLCJpYXQiOjE1OTkxMzM2NTAsIm5iZiI6MTU5OTEzMzY1MCwiZXhwIjoxNjMwNjY5NjUwLCJzdWIiOiIzIiwic2NvcGVzIjpbXX0.kmqGYbMhCwg_lpnON-Uk032FiERyP8kv97L41aA8pNm76mAtw5hBCGqmMn7S6eCSx_vif5JkoFrj60FDvVrxcTKPgUgG_ZRYEuAKv5RDONHCfiKSb7N6VqUUSYBs5jdbLjRGHU-lrHwiILK6wD-MEqD_eko0q_GqKZ3onrkzyQ_gNZnnOZ5qwQAuRjMxjzUM-rBbSQ3gtxGdZ70-8Q3zgsrSol8Of7yb6afOBPnsdlIME5RpyE26_rwjhMHq0kGgnayA_hSfKFuweODve8-7QOeCNGPCokmpEUXIJLADfzeyZhAIzTCWr7h4vNa8mEOrePcD43KYYeMfAkQnDKOuOY2xx0owy3r2z0kgXG4O76AXR3s_rwsSyc30oFxkKHeIRoavmqgBDlZqSQSTR_L2h-ygWgrogxSzdi5AMBKu4ajCIR0Z1S9ywOAklELeM0JgisfEt_WvLC83jCTXzPfXoIhYMlPm9GBvtwkiiUN92TqtssO40Mp9eCP1jnUow7vUK6Xi7nsBXRR8qH1jLIKEfja_FoMx0eZGxSRtQ8CQtkVjE4qXSBlQ65mkAsQu4nPvfvnykiqgqhpdZnKLBJnZ9HAtsTxJJmb2L5i4rlCc7DBMEHETb0nHpi-NxbLlKtecS9WCL_4-14INLjmxETDUjk6ddRG_bHOkhomrZTBPYV8

//定义登录路由
Route::post('login','Api\LoginController@login');

//请求验证
//符合restful标准
//uri独立域名或能区别的前缀api
//url最好有版本
//结果用名词不用动词
//内容可以用rsa对非对称加密 
//有中间件的路由访问
Route::group(['middleware'=>'auth:api','prefix'=>'v1','namespace'=>'Api'], function(){
   //访问此路由必须要有token的传入
   //passport使用头信息传入
    Route::get('users',function(){
        return '123456';
//         return base64_decode(base64_decode('TVRJek5EVTI='));
//         return base64_encode(base64_encode('123456'));
    });
    
    //小程序登录
    Route::post('wxlogin','LoginController@wxlogin');
    //更新用户信息
    Route::post('user/updateuserinfo','UserController@updateuserinfo');
    //获取用户信息
    Route::get('user/getuserinfo','UserController@getuserinfo');
    //上传身份信息
    Route::post('user/upfile','UserController@upfile');
    //查看预约信息
    Route::get('notice/noticeList','NoticeController@noticeList');
    //查询资讯信息
    Route::get('article/articleList','ArticleController@articleList');
    //查询资讯详情
    Route::get('article/articleDetail/{article}','ArticleController@articleDetail');
    //文章访问人数统计
    Route::post('article/articleCount','ArticleController@articleCount');
    
    //es搜索房源列表
    Route::get('esfangs','FangsController@esfang');
    //房源推荐读取
    Route::get('fangs/fangrecommendlist','FangsController@fangrecommendlist');
    //房源属性列表
    Route::get('fangs/attrlist','FangsController@attrlist');
    //获取房源列表
    Route::get('fangs/fanglist','FangsController@fanglist');
    //获取房源详情
    Route::get('fangs/fangDetail/{fang}','FangsController@fangDetail');
    //获取房源属性
    Route::get('fangattr','FangAttrController@fangattr');
    
    //添加收藏
    Route::post('favs/add','FavsController@add');
    //查询当前房源是否收藏
    Route::get('favs/find','FavsController@find');
    //取消收藏
    Route::get('favs/del','FavsController@del');
    
});